﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;

namespace Bussiness_Objects
{
    /// <summary>
    /// Thong tin LoaiDocGia
    /// --LOAIDOCGIA(MaLoaiDocGia,TenLoaiDocGia)
    /// </summary>
    public class LoaiDocGia : BusinessObjects
    {
        public LoaiDocGia()
        {
            MaLoaiDocGia = Int16.MaxValue;
            TenLoaiDocGia = null;
        }

        public LoaiDocGia(int _maDG, string _tenDG)
        {
            MaLoaiDocGia = _maDG;
            TenLoaiDocGia = _tenDG;
        }

        public override void SetParameterInsert()
        {
            parms = new object[1];
            SqlParameter _parm = new SqlParameter(parTenLoaiDocGia, TenLoaiDocGia);
            parms[0] = _parm;
        }

        public override void SetParameterUpdate()
        {
            parms = new object[2];
            SqlParameter _parm = new SqlParameter(parTenLoaiDocGia, TenLoaiDocGia);
            parms[0] = _parm;

            _parm = new SqlParameter(parMaLoaiDocGia, MaLoaiDocGia);
            parms[1] = _parm;
        }

        public void SetParameterDelete()
        {
            parms = new object[1];
            SqlParameter _parm = new SqlParameter(parMaLoaiDocGia, MaLoaiDocGia);
            parms[0] = _parm;
        }

        private const string parMaLoaiDocGia = "@MaLoaiDocGia";
        private const string parTenLoaiDocGia = "@TenLoaiDocGia";

        public int MaLoaiDocGia { get; set; }

        public string TenLoaiDocGia { get; set; }
    }
}
